<!DOCTYPE html>
<HTML>
<HEAD><meta name="viewport" content="width=device-width, initial-scale=1">
<Title>Image Maps, Hot Spots and CDML Tooltips</Title>
<link type='text/css' rel='Stylesheet' href="maxchartapi.css" />
</HEAD>
<body bgcolor="#FFFFFF" text="#000000" topmargin="0" leftmargin="0" rightmargin="0" marginwidth="0" marginheight="0">
<p class="heading0">ChartDirector 7.0 (Java Edition)</p>
<p class="heading1">Image Maps, Hot Spots and CDML Tooltips</p>
<hr class="separator">
<div class="content"> 
A hot spot is a region on an image that can generate mouse events and can have tooltip. For example, on a bar chart, each bar can be a hot spot. The bar can then generate mouse click and other mouse events, and can pop up a tooltip box when the mouse hovers on it.<br><br>
HTML image maps are a standard way to define hot spots. It defines the hot spot regions and their associate parameters and tooltips. ChartDirector can generate HTML image maps for the charts by using <a href="BaseChart.getHTMLImageMap.htm">BaseChart.getHTMLImageMap</a> and other similar methods. Many of the examples that come with ChartDirector use this method to configure tooltips for the charts.<br><br>
Since HTML is an open standard, you can append custom image map entries to define custom hot spots on the chart. For example, if you include your company logo on the chart, you may define a hot spot for the logo to make it clickable.
</div><p class="heading2">CDML Tooltips</p><div class="content">
The most common usage of image maps is to define tooltips for the chart objects.<br><br>
In HTML image maps, tooltips are configured with the "title" attributes. For example, in <a href="BaseChart.getHTMLImageMap.htm">BaseChart.getHTMLImageMap</a>, the attribute <code>title='{xLabel}: {value}'</code> will configure the tooltip to display the x-axis label associated with the hot spot, followed by a colon and a space, and after that the data value associated with the hot spot.<br><br>
By default, the tooltip will be displayed using the default tooltip mechanism of the programming framework. For a web application, it will be displayed using the tooltip mechanism provided by the browser. For a desktop application, it will be provided by the desktop GUI framework. Typically, the tooltip will be a small box with a line of text and the style is not configurable.<br><br>
ChartDirector also supports enhanced CDML tooltips with rich formatting. The tooltip will be rendered by ChartDirector directly. It can include multiple fonts, colors, images, icons or even another chart, and can be semi-transparent. Unlikely the default tooltip which appears only when the mouse hovers on the hot spot for a short time, the CDML tooltip pops up instantaneously when the mouse enters the hot spot and will follow the mouse as it moves. The <a href='cdmltooltip.htm'>CDML Tooltips</a> sample code contains a few examples of using CDML tooltips.
</div><p class="heading2">Web CDML Tooltips</p><div class="content">
For web applications, CDML tooltips can be enabled by starting the tooltip with the <code>&lt;*cdml*&gt;</code> tag. The tooltip can them be formatted by using modified HTML, which is the same as HTML with the "&lt;" and "&gt;" changed to "&lt;*" and "*&gt;". A simple example is:<br><br>
<div class="indentedblock"><code>&lt;*cdml*&gt;&lt;*b*&gt;{label}:&lt;*/<wbr>b*&gt; {value}</code></div><br>
<div class="greyblock"> For backwards compatibility, in tooltips, the "&lt;" and "&gt;" characters are treated as normal tooltip text, not HTML tags. That's why all HTML tags must be modified to use "&lt;*" and "*&gt;". </div><br>
The standard CDML tooltip will use a tooltip box with white background, grey border and rounded corners. You can customize the tooltip box style by adding a style attribute or class attribute to the <code>&lt;*cdml*&gt;</code> tag. An example :<br><br>
<div class="indentedblock"><code>&lt;*cdml style=<wbr>"background:#000; color:#fff; padding:3px" *&gt;{label}: {value}</code></div><br>
If you add a "class" attribute, you can set the style using an style sheet just similar to styling a normal HTML tag.<br><br>
Note that to use CDML tooltips, the web page must include the ChartDirector Javascript library "cdjcv.js". On the server side, <a href="WebChartViewer.htm">WebChartViewer</a>  must be used to represent the chart on the web page.</div><br>
<hr class="separator"><div class="copyright">&copy; 2022 Advanced Software Engineering Limited. All rights reserved.</div></body>
</HTML>
